<template>
  <view :style="themeColor">
    <view class="page">
      <view class="flex benben-position-layout flex flex-wrap align-center inviteFriends_flex_0"
        :style="{height:(88+StatusBarRpx)+'rpx',paddingTop:StatusBarRpx+'rpx', }">
        <view class='flex flex-wrap align-center justify-between flex-sub inviteFriends_fd0_0'>
          <view class='flex flex-wrap align-center inviteFriends_fd0_0_c0' @tap.stop="handleJumpDiy" data-type="back"
            data-url="1">
            <text class='fu-iconfont2  inviteFriends_fd0_0_c0_c0'>&#xE794;</text>
          </view>
          <view class='flex flex-wrap align-stretch justify-center'>
            <text class='inviteFriends_fd0_0_c1_c0'>{{$t('邀请好友')}}</text>
          </view>
          <view class='flex flex-wrap align-center justify-end inviteFriends_fd0_0_c0'>
          </view>
        </view>

      </view>
      <view :style="{height: (88+StatusBarRpx)+'rpx'}"></view>
      <!---flex布局flex布局开始-->
      <view class="flex flex-direction flex-wrap align-stretch benben-flex-layout inviteFriends_flex_1">
        <view class='flex flex-direction flex-wrap align-stretch inviteFriends_fd1_0'>
          <view class='flex flex-wrap align-center inviteFriends_fd1_0_c0'>
            <image class='inviteFriends_fd1_0_c0_c0' mode="aspectFit" :src='dataINfo.avatar'></image>
            <text class='inviteFriends_fd1_0_c0_c1'>{{dataINfo.nickname}}</text>
          </view>
          <view class='flex flex-wrap align-center justify-center inviteFriends_fd1_0_c1'>
            <image class='inviteFriends_fd1_0_c1_c0' mode="aspectFit" :src='ode.thumb'></image>
          </view>
        </view>
        <view class='flex flex-direction flex-wrap align-center inviteFriends_fd1_1'>
          <button class='inviteFriends_fd1_1_c0' @click.stop="saveImage">{{$t('保存图片到相册')}}</button>
          <button class='inviteFriends_fd1_1_c1' @click.stop="popupShow1703424864537=true">{{$t('一键分享')}}</button>
        </view>
      </view>

      <!---flex布局flex布局结束-->


    </view>
    <benben-popup v-model="popupShow1703424864537" :mask="true" :mask-close-able="false" mode='bottom' :z-index='999'>
      <!---分享flex布局开始-->
      <view class="flex flex-direction flex-wrap align-stretch benben-flex-layout">
        <view class='flex flex-direction flex-wrap align-stretch rticleDetails_fd2_0'>
          <view class='flex flex-wrap align-center justify-between rticleDetails_fd2_0_c0'>
            <view class='flex flex-wrap align-center rticleDetails_fd2_0_c0_c0'>
            </view>
            <view class='flex flex-wrap align-center justify-center rticleDetails_fd2_0_c0_c1'>
              <text class='rticleDetails_fd2_0_c0_c1_c0'>{{$t('分享到')}}</text>
            </view>
            <view class='flex flex-wrap align-center rticleDetails_fd2_0_c0_c2'>
              <image class='rticleDetails_fd2_0_c0_c2_c0' mode="aspectFit" :src='STATIC_URL+"100.png"'
                @tap.stop="popupShow1703424864537=false"></image>
            </view>
          </view>
          <view class='flex flex-wrap align-center justify-around rticleDetails_fd2_0_c1'>
            <view class='flex flex-direction flex-wrap align-center' @click.stop="shareApp('1')">
              <image class='rticleDetails_fd2_0_c1_c0_c0' mode="aspectFit" :src='STATIC_URL+"11.png"'></image>
              <text class='rticleDetails_fd2_0_c1_c0_c1'>{{$t('微信好友')}}</text>
            </view>
            <view class='flex flex-direction flex-wrap align-center' @click.stop="shareApp('2')">
              <image class='rticleDetails_fd2_0_c1_c0_c0' mode="aspectFit" :src='STATIC_URL+"12.png"'></image>
              <text class='rticleDetails_fd2_0_c1_c0_c1'>{{$t('朋友圈')}}</text>
            </view>
          </view>
        </view>
      </view>

      <!---分享flex布局结束-->

    </benben-popup>
  </view>
</template>
<script>
  import {
    validate
  } from '@/common/utils/validate.js'
  export default {
    components: {},


    data() {
      return {
        popupShow1703424864537: false,
        "dataINfo": {
          "invite_code": "",
          "address": "",
          "address_code": "",
          "hobby": "",
          "tags": "",
          "id": "",
          "userlevel_id": "",
          "mobile": "",
          "real_name": "",
          "avatar": "",
          "account": "",
          "email": "",
          "birthday": "",
          "gender": "",
          "create_time": "",
          "user_money": "",
          "freeze_money": "",
          "total_consumption_money": "",
          "score": "",
          "_mobile": "",
          "coupon": "",
          "collection_count": "",
          "browse_count": "",
          "total_money": "",
          "certified": "",
          "nickname": "",
          "is_pay_password": "",
          "follow_count": "",
          "is_close": ""
        },
        "ode": {
          "thumb": "",
          "url": ""
        }
      };
    },
    computed: {
      themeColor() {
        return this.$store.getters.themeColor
      },

    },
    watch: {},
    onLoad(options) {
      this.getinfoeFunc()
      this.getCodeFunc()
    },
    onUnload() {

    },
    onReady() {

    },
    onShow() {

    },
    onHide() {

    },
    onResize() {

    },
    onPullDownRefresh() {

    },
    onReachBottom(e) {

    },
    onPageScroll(e) {

    },
    methods: {
      shareApp(type) {
        let that = this
        let provider = ''
        let scene = ''
        if (type == 1) {
          provider = 'weixin'
          scene = 'WXSceneSession'
        } else if (type == 2) {
          provider = 'weixin'
          scene = 'WXSenceTimeline'
        }
        // let links = that.apartmentDetails.h5_share +
        //   `/pages/shouye/apartmentDetails/apartmentDetails?id=${that.apartmentDetails.aid}`
        // console.log(' that.apartmentDetails', links)
        uni.share({
          provider: provider,
          scene: scene,
          type: '0',
          imageUrl: that.dataINfo.avatar,
          title: '加拿大靈巖山寺APP',
          href: that.ode.url,
          success: function(res) {
            console.log('22222')
            console.log("success:" + JSON.stringify(res));
          },
          fail: function(err) {
            console.log("fail:" + JSON.stringify(err));
          }
        });
      },
      saveImage() {
        let that = this
        uni.saveImageToPhotosAlbum({
          filePath: that.ode.thumb,
          success: function() {
            that.$message.info(global.i18n.t('保存成功'))
            console.log('save success');
          }
        });
      },
      //获取会员信息
      async getinfoeFunc() {
        //请求方法
        //数据验证

        let datadataINfo = await this.$api.get(global.apiUrls.post5c78c4772da97, {

        });

        if (datadataINfo.data.code != 1) {
          this.$message.info(datadataINfo.data.msg);
          return
        }
        let infodataINfo = datadataINfo.data;
        this.dataINfo = infodataINfo.data

      },
      //获取二维码
      async getCodeFunc() {
        //请求方法
        //数据验证

        let dataode = await this.$api.post(global.apiUrls.post658961063920b, {

        });

        if (dataode.data.code != 1) {
          this.$message.info(dataode.data.msg);
          return
        }
        let infoode = dataode.data;
        this.ode = infoode.data
        this.url = infoode.data.url
      }
    }
  };
</script>
<style lang="scss" scoped>
  .rticleDetails_fd2_0_c1_c0_c1 {
    font-size: 24rpx;
    font-weight: 400;
    color: #333;
  }

  .rticleDetails_fd2_0_c1_c0_c0 {
    width: 80rpx;
    height: 80rpx;
    border-radius: 40rpx 40rpx 40rpx 40rpx;
    margin: 0rpx 0rpx 16rpx 0rpx;
  }

  .rticleDetails_fd2_0_c1 {
    padding: 0rpx 0rpx 58rpx 0rpx;
  }

  .rticleDetails_fd2_0_c0_c2_c0 {
    width: 40rpx;
    height: 40rpx;
    border-radius: 20rpx 20rpx 20rpx 20rpx;
  }

  .rticleDetails_fd2_0_c0_c2 {
    margin: 0rpx 2rpx 0rpx 0rpx;
  }

  .rticleDetails_fd2_0_c0_c1_c0 {
    font-size: 32rpx;
    font-weight: 400;
    color: #333333;
    margin: 0rpx 16rpx 0rpx 16rpx;
    line-height: 46rpx;
  }

  .rticleDetails_fd2_0_c0_c1 {
    padding: 40rpx 0rpx 48rpx 0rpx;
  }

  .rticleDetails_fd2_0_c0_c0 {
    width: 40rpx;
  }

  .rticleDetails_fd2_0_c0 {
    padding: 0rpx 13rpx 0rpx 0rpx;
  }

  .rticleDetails_fd2_0 {
    background: #fff;
    background-size: 100% auto !important;
    border-radius: 24rpx 24rpx 0rpx 0rpx;
    padding: 0rpx 32rpx 0rpx 32rpx;
  }



  .page {
    width: 100vw;
    overflow-x: hidden;
    min-height: calc(100vh - var(--window-bottom));
    background: rgba(247, 243, 237, 1);
    background-size: 100% auto;
  }

  .inviteFriends_flex_0 {
    border-bottom: 1px solid #eee;
    background: rgba(247, 243, 237, 1);
    width: 750rpx;
    height: 88rpx;
    overflow: hidden;
    z-index: 10;
    top: 0rpx;
    background-size: 100% auto !important;
  }

  .inviteFriends_fd0_0_c1_c0 {
    font-size: 36rpx;
    font-weight: 700;
    color: #333333;
    line-height: 50rpx;
  }

  .inviteFriends_fd0_0_c0_c0 {
    font-size: 36rpx;
    color: #333;
  }

  .inviteFriends_fd0_0_c0 {
    width: 120rpx;
  }

  .inviteFriends_fd0_0 {
    padding: 0rpx 32rpx 0rpx 32rpx;
  }

  .inviteFriends_flex_1 {
    padding: 71rpx 32rpx 0rpx 32rpx;
  }

  .inviteFriends_fd1_1_c1 {
    background: rgba(145, 47, 34, 1);
    border-radius: 44rpx;
    width: 650rpx;
    line-height: 80rpx;
    font-size: 32rpx;
    color: #fff;
    margin: 16rpx 0rpx 0rpx 0rpx;
  }

  .inviteFriends_fd1_1_c0 {
    background: rgba(152, 112, 64, 1);
    border-radius: 44rpx;
    width: 650rpx;
    line-height: 80rpx;
    font-size: 32rpx;
    color: #fff;
  }

  .inviteFriends_fd1_1 {
    margin: 58rpx 0rpx 0rpx 0rpx;
  }

  .inviteFriends_fd1_0_c1_c0 {
    width: 412rpx;
    height: 412rpx;
    border-radius: 0rpx 0rpx 0rpx 0rpx;
  }

  .inviteFriends_fd1_0_c1 {
    margin: 126rpx 0rpx 0rpx 0rpx;
  }

  .inviteFriends_fd1_0_c0_c1 {
    color: #333333;
    font-size: 32rpx;
    font-weight: 500;
    line-height: 32rpx;
  }

  .inviteFriends_fd1_0_c0_c0 {
    width: 80rpx;
    height: 80rpx;
    border-radius: 0rpx 0rpx 0rpx 0rpx;
    margin: 0rpx 28rpx 0rpx 0rpx;
  }

  .inviteFriends_fd1_0_c0 {
    margin: 68rpx 0rpx 0rpx 68rpx;
  }

  .inviteFriends_fd1_0 {
    background: url(image-path('75.png')) no-repeat;
    background-size: 100% auto;
    height: 774rpx;
  }
</style>
